Update Document
curl --request PUT \
--url https://api.sophra.org/api/cortex/documents/{test_doc_id} \
--header 'Content-Type: application/json' \
--data '
"{\n \"title\": \"{{updated_test_doc_title}}\",\n \"abstract\": \"{{updated_test_doc_abstract}}\",\n \"authors\": {{updated_test_doc_authors}},\n \"metadata\": {\"updated\": true},\n \"tags\": {{updated_test_doc_tags}},\n \"source\": \"{{updated_test_doc_source}}\"\n}"
'import requests
url = "https://api.sophra.org/api/cortex/documents/{test_doc_id}"
payload = "{
\"title\": \"{{updated_test_doc_title}}\",
\"abstract\": \"{{updated_test_doc_abstract}}\",
\"authors\": {{updated_test_doc_authors}},
\"metadata\": {\"updated\": true},
\"tags\": {{updated_test_doc_tags}},
\"source\": \"{{updated_test_doc_source}}\"
}"
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify('{\n "title": "{{updated_test_doc_title}}",\n "abstract": "{{updated_test_doc_abstract}}",\n "authors": {{updated_test_doc_authors}},\n "metadata": {"updated": true},\n "tags": {{updated_test_doc_tags}},\n "source": "{{updated_test_doc_source}}"\n}')
};
fetch('https://api.sophra.org/api/cortex/documents/{test_doc_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sophra.org/api/cortex/documents/{test_doc_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode('{
"title": "{{updated_test_doc_title}}",
"abstract": "{{updated_test_doc_abstract}}",
"authors": {{updated_test_doc_authors}},
"metadata": {"updated": true},
"tags": {{updated_test_doc_tags}},
"source": "{{updated_test_doc_source}}"
}'),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sophra.org/api/cortex/documents/{test_doc_id}"
payload := strings.NewReader("\"{\\n \\\"title\\\": \\\"{{updated_test_doc_title}}\\\",\\n \\\"abstract\\\": \\\"{{updated_test_doc_abstract}}\\\",\\n \\\"authors\\\": {{updated_test_doc_authors}},\\n \\\"metadata\\\": {\\\"updated\\\": true},\\n \\\"tags\\\": {{updated_test_doc_tags}},\\n \\\"source\\\": \\\"{{updated_test_doc_source}}\\\"\\n}\"")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.sophra.org/api/cortex/documents/{test_doc_id}")
.header("Content-Type", "application/json")
.body("\"{\\n \\\"title\\\": \\\"{{updated_test_doc_title}}\\\",\\n \\\"abstract\\\": \\\"{{updated_test_doc_abstract}}\\\",\\n \\\"authors\\\": {{updated_test_doc_authors}},\\n \\\"metadata\\\": {\\\"updated\\\": true},\\n \\\"tags\\\": {{updated_test_doc_tags}},\\n \\\"source\\\": \\\"{{updated_test_doc_source}}\\\"\\n}\"")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sophra.org/api/cortex/documents/{test_doc_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "\"{\\n \\\"title\\\": \\\"{{updated_test_doc_title}}\\\",\\n \\\"abstract\\\": \\\"{{updated_test_doc_abstract}}\\\",\\n \\\"authors\\\": {{updated_test_doc_authors}},\\n \\\"metadata\\\": {\\\"updated\\\": true},\\n \\\"tags\\\": {{updated_test_doc_tags}},\\n \\\"source\\\": \\\"{{updated_test_doc_source}}\\\"\\n}\""
response = http.request(request)
puts response.read_bodyCortex > Document Operations
Update Document
PUT
/
cortex
/
documents
/
{test_doc_id}
Update Document
curl --request PUT \
--url https://api.sophra.org/api/cortex/documents/{test_doc_id} \
--header 'Content-Type: application/json' \
--data '
"{\n \"title\": \"{{updated_test_doc_title}}\",\n \"abstract\": \"{{updated_test_doc_abstract}}\",\n \"authors\": {{updated_test_doc_authors}},\n \"metadata\": {\"updated\": true},\n \"tags\": {{updated_test_doc_tags}},\n \"source\": \"{{updated_test_doc_source}}\"\n}"
'import requests
url = "https://api.sophra.org/api/cortex/documents/{test_doc_id}"
payload = "{
\"title\": \"{{updated_test_doc_title}}\",
\"abstract\": \"{{updated_test_doc_abstract}}\",
\"authors\": {{updated_test_doc_authors}},
\"metadata\": {\"updated\": true},
\"tags\": {{updated_test_doc_tags}},
\"source\": \"{{updated_test_doc_source}}\"
}"
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify('{\n "title": "{{updated_test_doc_title}}",\n "abstract": "{{updated_test_doc_abstract}}",\n "authors": {{updated_test_doc_authors}},\n "metadata": {"updated": true},\n "tags": {{updated_test_doc_tags}},\n "source": "{{updated_test_doc_source}}"\n}')
};
fetch('https://api.sophra.org/api/cortex/documents/{test_doc_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sophra.org/api/cortex/documents/{test_doc_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode('{
"title": "{{updated_test_doc_title}}",
"abstract": "{{updated_test_doc_abstract}}",
"authors": {{updated_test_doc_authors}},
"metadata": {"updated": true},
"tags": {{updated_test_doc_tags}},
"source": "{{updated_test_doc_source}}"
}'),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sophra.org/api/cortex/documents/{test_doc_id}"
payload := strings.NewReader("\"{\\n \\\"title\\\": \\\"{{updated_test_doc_title}}\\\",\\n \\\"abstract\\\": \\\"{{updated_test_doc_abstract}}\\\",\\n \\\"authors\\\": {{updated_test_doc_authors}},\\n \\\"metadata\\\": {\\\"updated\\\": true},\\n \\\"tags\\\": {{updated_test_doc_tags}},\\n \\\"source\\\": \\\"{{updated_test_doc_source}}\\\"\\n}\"")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.sophra.org/api/cortex/documents/{test_doc_id}")
.header("Content-Type", "application/json")
.body("\"{\\n \\\"title\\\": \\\"{{updated_test_doc_title}}\\\",\\n \\\"abstract\\\": \\\"{{updated_test_doc_abstract}}\\\",\\n \\\"authors\\\": {{updated_test_doc_authors}},\\n \\\"metadata\\\": {\\\"updated\\\": true},\\n \\\"tags\\\": {{updated_test_doc_tags}},\\n \\\"source\\\": \\\"{{updated_test_doc_source}}\\\"\\n}\"")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sophra.org/api/cortex/documents/{test_doc_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "\"{\\n \\\"title\\\": \\\"{{updated_test_doc_title}}\\\",\\n \\\"abstract\\\": \\\"{{updated_test_doc_abstract}}\\\",\\n \\\"authors\\\": {{updated_test_doc_authors}},\\n \\\"metadata\\\": {\\\"updated\\\": true},\\n \\\"tags\\\": {{updated_test_doc_tags}},\\n \\\"source\\\": \\\"{{updated_test_doc_source}}\\\"\\n}\""
response = http.request(request)
puts response.read_body
